/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ie.tcd.cs.railtickets.agent.config;

import ie.tcd.cs.railtickets.commons.util.PropertiesUtil;
import java.io.IOException;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author Wenbo Sun
 */
public class ConfigProperties {

    private static ConfigProperties instance;
    private static Properties properties;
    private static final Log log = LogFactory.getLog(ConfigProperties.class);
    private static String CONFIGFILE = "config/operator.properties";

    public ConfigProperties() {
        try {
            log.debug("load config properties ...");
            properties = PropertiesUtil.getProperties(CONFIGFILE);
        } catch (IOException ex) {
            log.error("load properties failed!", ex);
        }
    }

    public static ConfigProperties getInstance() {
        synchronized (ConfigProperties.class) {
            if (instance == null)
                return new ConfigProperties();
        }
        return instance;
    }

    public Properties getProperties() {
        return properties;
    }


}
